<?php

namespace admin\controllers;

use app\models\UserLevel;
use admin\components\BaseAuthController;

class UserLevelController extends BaseAuthController{

    public $name = '用户等级';

    public function actionIndex(){
        $model = new UserLevel();
        $dataProvider = $model->search();
        return $this->render(compact('dataProvider'));
    }

    public function actionSave($id = false){
        /* @var $model UserLevel */
        $model = $this->findModel($id, UserLevel::className());
        if (!$model->load($this->post())) {
            return $this->render(compact('model'));
        }
        return $model->save();
    }

    public function actionView($id){
        return $this->render(['model' => $this->findModel($id,UserLevel::className())]);
    }
}
